package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {
    //新增菜品之口味
    @Insert("insert into sky_take_out.dish_flavor values (null,#{dishId},#{name},#{value})")
    void save(DishFlavor dishFlavor);

    //根据菜品id查询口味列表
    @Select("select * from sky_take_out.dish_flavor where dish_id=#{dishId}")
    List<DishFlavor> findByDishId(Long id);

    //根据菜品id删除
    @Delete("delete  from sky_take_out.dish_flavor where dish_id=#{dishId}")
    void deleteByDishId(Long dishId);

    //主键删除
    @Delete("delete from dish where id = #{id}")
    void deleteById(Long id);
}
